#include "Ticker.h"

#include "windows.h"

__int64 Ticker::m_Frequency = 0;

Ticker::Ticker(void)
:m_Start(0)
{
	if(m_Frequency == 0) {
		QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(&m_Frequency));
	}

	Reset();
}

Ticker::~Ticker(void)
{
}

__int64 Ticker::GetLapsed() const
{
	return ((GetCount() - m_Start) * 1000) / m_Frequency;
}

void Ticker::Reset()
{
	m_Start = GetCount();
}

__int64 Ticker::GetCount() const
{
	__int64 l_New = 0;
	QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&l_New));

	return l_New;
}
